package com.xz.realdemo2.model;

import java.io.*;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     OfficalDocTemplate   
 * @package    com.xz.realdemo2.model  
 * @date   2019/12/2 16:12  
 * @explain
 */
public class OfficalDocTemplate {

    private String name;
    private String content;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "OfficalDocTemplate{" +
                "name='" + name + '\'' +
                ", content='" + content + '\'' +
                '}';
    }

    public OfficalDocTemplate deepClone() throws IOException, ClassNotFoundException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);

        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        return (OfficalDocTemplate) ois.readObject();
    }

    public void createOfficalDoc(){
        System.out.println("公文名称:"+name+"  内容："+content);
    }

}
